package com.wjy.rbac.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wjy.rbac.entity.PowerRequestMethod;
import com.wjy.rbac.mapper.PowerRequestMethodMapper;
import com.wjy.rbac.service.IPowerRequestMethodService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ybxxszl
 * @since 2019-04-12
 */
@Service
public class PowerRequestMethodServiceImpl extends ServiceImpl<PowerRequestMethodMapper, PowerRequestMethod>
        implements IPowerRequestMethodService {

    @Override
    public void insert(PowerRequestMethod powerRequestMethod) {
        save(powerRequestMethod);
    }

    @Override
    public void update(PowerRequestMethod powerRequestMethod) {
        updateById(powerRequestMethod);
    }

    @Override
    public void delete(String powerRequestMethodId) {
        removeById(powerRequestMethodId);
    }

    @Override
    public Map<String, Object> get(String powerRequestMethodId) {
        Map<String, Object> result = new HashMap<String, Object>();
        PowerRequestMethod powerRequestMethod = getById(powerRequestMethodId);
        result.put("powerRequestMethod", powerRequestMethod);
        return result;
    }

    @Override
    public List<PowerRequestMethod> getByPowerId(String powerId) {
        Map<String, Object> columnMap = new HashMap<String, Object>();
        columnMap.put(PowerRequestMethod.POWER_ID, powerId);
        List<PowerRequestMethod> powerRequestMethodList = (List<PowerRequestMethod>) listByMap(columnMap);
        return powerRequestMethodList;
    }

}
